1. Field of the Invention
This invention relates to computer display systems and, more particularly, to an apparatus for controlling the switching between frame buffers in a double buffered display system so that frame tearing does not occur.
2. History of the Prior Art
A typical computer system generates data which is displayed on an output display. This output display is typically a cathode ray tube which produces a number of full screen images one after another so rapidly that to the eye of the viewer the screen appears to display constant motion when a program being displayed produces such motion. In order to produce the individual images (frames) which are displayed one after another, data is written into a frame buffer. The frame buffer stores information about each position on the display which can be illuminated (each pixel) to produce the full screen image. For example, a display may be capable of displaying pixels in approximately one thousand horizontal rows each having approximately one thousand pixels. All of this information in each frame is written to the frame buffer before it is scanned to the display.
When data describing an entire picture exists in the frame buffer, the frame may be transferred to the display. Typically, data is transferred from the frame buffer to the display pixel by pixel and line by line beginning at the upper left hand corner of the display and proceeding horizontally from left to right, line by line, downward to the lower right hand corner of the display. In order for the picture to appear continuous on the output display, the successive frames in the frame buffer must be constantly scanned to the output display at a rate of thirty frames per second or more.
While each frame of data is being scanned to the display, new data to appear in a succeeding frame must be transferred to the frame buffer. In general, only data which is changing replaces old data in the frame buffer. This occurs at frame buffer positions representing those pixel positions which are changing on the screen. All unchanged data remains in the frame buffer without change. New data to be displayed in a frame may be written to the portion of the frame buffer being changed at any time. In order to allow information to be both written to the frame buffer and scanned from the frame buffer to the output display simultaneously, two ported video random access memory (VRAM) is used for the frame buffer. Data is written through one port and scanned to the display through the other.
If data is being placed in a VRAM frame buffer at the same time that information is being scanned to the display, it is possible that information being scanned to the display will come from two time displaced frames. For example, if scanning is proceeding at a faster rate than data is being written to the frame buffer and a portion of the frame buffer which is changing (being written) is scanned to the display, a portion of the display will be from what should be a first frame and a portion from what should be a succeeding frame. The display of portions of two time displaced frames simultaneously is called frame tearing. The visual effect is half drawn objects on the screen. This can be disconcerting where the display is rapidly changing as in real time video, for images may be grossly distorted.
In order to eliminate frame tearing, double buffered display memory is used. Double buffering uses two complete frame buffers each of which may store one entire frame. Data is written to one frame buffer and scanned to the display from the other. In its simplest form, this is accomplished using a pair of VRAM frame buffers and multiplexing the data in one or the other of the frame buffers to the display. In this form, data is never written to a frame buffer during the time its contents are being scanned to the display. Once a frame has been completely written, it may in turn be scanned to the display and data written to the other frame buffer. Since data is never written to a frame buffer while its contents are being scanned to the display, frame tearing cannot occur.
Since in a double buffered system only whole frames are actually displayed one after another on the output display to create a picture, the instant at which the multiplexor switches from scanning data in one frame buffer to the display to scanning data in the other to the display may occur only during a period after one frame is completely scanned and the next has not yet begun. This is the period during which the raster beam which scans the data to the face of the display is retracing from the lower right corner of the screen to begin a new frame at the upper left hand corner of the screen. The period is called the vertical retrace.
Typically, the circuitry controlling the writing of information to the frame buffers will assert a signal indicating to the multiplexing circuitry that a write operation to the inactive frame buffer is complete and that the frame therein may be scanned to the display. This signal is used to switch the multiplexor to display data from the inactive frame buffer. Typically this signal is furnished by the central processing system. If the multiplexing circuitry is in the middle of transferring a frame of information to the display, that frame cannot be interrupted. Thus, the central processing system must continue to assert the signal until the frame is complete and the multiplexor can switch to scan data from the other frame buffer. Since the central processing system must continue to assert the signal, it cannot accomplish other of its tasks during this interval. This causes a significant reduction in the speed of operation of the computer.